#!encoding=utf-8;extension=/WEB-INF/closure.js
<pre>
{foreach $name in $names}
{if not $greetingWord}
    Hello {$name}!
{else}
    {$greetingWord} {$name}!
{/if}
{ifempty}
.....
{/foreach}
</pre>


{namespace example}
<!-- 前端模板（不同GCT，GCT需要编译，也不能直接插入） -->
{template .testSoy}
{foreach $name in $names}
{if not $greetingWord}
    Hello {$name}!
{else}
    {$greetingWord} {$name}!
{/if}
{ifempty}
.....
{/foreach}
{/template}


<script>
var data = new Object();
data.$greetingWord='hehe';
data.$names=['kexin','dawei','niuyao'];
alert(example.testSoy(data));
</script>